package com.szholly.pro.watergas_server.ps.data;

import java.util.HashMap;

import com.szholly.data.general.metadata.table.DefulatDomainTable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.szholly.data.general.Field;
import com.szholly.data.general.InterceptorTableBase;
import com.szholly.data.general.metadata.IBaseTable;
import com.szholly.utils.spring.SpringBeanFactory;
import org.springframework.stereotype.Component;
import com.szholly.data.general.GlobalDataType;
import com.szholly.data.general.RowBase;


/**
 * OperationAlarmInfo
 */
@Component("OperationAlarmInfo")
public class OperationAlarmInfoTable extends InterceptorTableBase  implements IBaseTable{

	public final static String TABLE_NAME = "OP_ALAR_INFO";



	@Autowired
	private static SpringBeanFactory springBeanFactory;
	
	/**
	 * single ref
	 */
	public static OperationAlarmInfoTable getSingleRef() {
		return (OperationAlarmInfoTable) SpringBeanFactory.getBean("OperationAlarmInfo");
	}

	@Override
	public String getMetadataTableName() {
		return TABLE_NAME;
	}

	@Override
	public String getMetadataTableAliasName() {
		return "OperationAlarmInfo";
	}

	private HashMap<String, Field> fields;

	@Override
	protected HashMap<String, Field> fields() {
		if (fields == null) {
			fields = new HashMap<String, Field>();
						
			Field itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_StartTime);
			itemField.setDataType(GlobalDataType.DateTime);
			itemField.setFieldID(5);
			itemField.setFieldAliasName("START_TIME");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_AlarmThreshold);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(6);
			itemField.setFieldAliasName("ALARM_THRESHOLD");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_IsPopup);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(7);
			itemField.setFieldAliasName("IS_POPUP");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_AlarmValue);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(8);
			itemField.setFieldAliasName("ALARM_VALUE");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_WwtpId);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(9);
			itemField.setFieldAliasName("WWTP_ID");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_Guid);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(10);
			itemField.setFieldAliasName("GUID");
			itemField.setIsKey(true);
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_MobileReceived);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(11);
			itemField.setFieldAliasName("MOBILE_RECEIVED");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_Param);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(12);
			itemField.setFieldAliasName("PARAM");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_PopupBy);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(13);
			itemField.setFieldAliasName("POPUP_BY");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_StationCode);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(14);
			itemField.setFieldAliasName("STATION_CODE");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_Type);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(15);
			itemField.setFieldAliasName("TYPE");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_ReceivedBy);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(16);
			itemField.setFieldAliasName("RECEIVED_BY");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
			
			itemField = new Field();
			itemField.setFieldName(OperationAlarmInfoRow.FIELD_AlarmCause);
			itemField.setDataType(GlobalDataType.String);
			itemField.setFieldID(109);
			itemField.setFieldAliasName("ALARM_CAUSE");
			itemField.setCanShow(false);
			fields.put(itemField.getFieldName().toUpperCase().trim(), itemField);
		}
		return fields;
	}

	@Override
	public String getTableGroup() {
		return "OperationAlarmInfo";
	}
}